<!--
 * @Author: HeAo
 * @Date: 2021-10-08 15:06:55
 * @LastEditTime: 2021-10-08 16:58:20
 * @LastEditors: HeAo
 * @Description: 
 * @FilePath: \web2103-2105\web2103code\3-2-Vue\day01\5-列表渲染.html
 * 别乱动！
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>再见Vue</title>
  <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.14/vue.js"></script>
</head>

<body>
  <div id="app">
    <ul>
      <li v-for="(item, index) in categories">
        索引: {{index}}
        编号：{{item.id}}
        名称：{{item.name}}
      </li>
    </ul>
  </div>
  <script>
    let vm = new Vue({
      el: '#app',
      data: {
        categories: []
      },
      methods: {
        findAllCategories() {
          this.categories = [
            { id: 1, name: '校园新闻' },
            { id: 2, name: '娱乐新闻' },
            { id: 3, name: '热点聚焦' },
            { id: 4, name: '体坛赛事' },
          ]
        }
      },
      created() {
        this.findAllCategories()
      }
    })
  </script>
</body>

</html>